package com.test.nnooolwdeaer.dec_wooden.data_wooden

import android.content.Context
import android.os.Build
import com.test.nnooolwdeaer.dec_wooden.util_wooden.GeneralUtil_wooden
import com.test.nnooolwdeaer.dec_wooden.util_wooden.HardwareUtil_wooden
import com.test.nnooolwdeaer.dec_wooden.util_wooden.NetworkUtil_wooden
import com.test.nnooolwdeaer.dec_wooden.util_wooden.gzipString
import com.google.gson.Gson

class HardwareInfo_wooden(val context: Context) {

    fun fetch(): String? {
        return try {
           val data = hashMapOf<String, Any>().apply {
                put("operatingSystem", "ANDROID")
                put("model", Build.MODEL.toString())
                put("serial", Build.SERIAL.toString())
                put("productionDate", Build.TIME.toString())
                put("sdkVersion", Build.VERSION.SDK_INT.toString())
                put("phoneType", GeneralUtil_wooden.getPhoneType(context))
                put("versionCode", GeneralUtil_wooden.getVersionCode(context))
                put("versionName", GeneralUtil_wooden.getVersionName(context))
                put("androidId", GeneralUtil_wooden.getAndroidID(context))
                put("telephony", GeneralUtil_wooden.getSimOperatorName(context))
                put("isVpn", NetworkUtil_wooden.getVpnState(context))
                put("isProxyPort", NetworkUtil_wooden.getIsWifiProxy())
                put("isDebug", GeneralUtil_wooden.getIsDebug(context))
                put("simState", GeneralUtil_wooden.getSimCardState(context))
                put("root", HardwareUtil_wooden.getIsRoot())
                put("physicalSize", HardwareUtil_wooden.getPhySicalSize(context))
                put("displayLanguage", GeneralUtil_wooden.getDisplayLanguage())
                put("iso3Language", GeneralUtil_wooden.getIso3Language())
                put("iso3Country", GeneralUtil_wooden.getIso3Country())
                put("networkOperatorName", GeneralUtil_wooden.getSimOperatorName(context))
                put("networkType", GeneralUtil_wooden.getNetworkType(context))
                put("timeZoneId", GeneralUtil_wooden.getTimeZoneId())
                put("elapsedRealtime", GeneralUtil_wooden.getElapsedRealtime())
                put("sensorList", HardwareUtil_wooden.getSensorList(context))
                put("lastBootTime", GeneralUtil_wooden.getLastBootTime())
                put("rootJailbreak", HardwareUtil_wooden.getIsRoot())
                put("keyboard", HardwareUtil_wooden.getKeyboard(context))
                put("isSimulator", HardwareUtil_wooden.getIsSimulator())
                put("dbm", HardwareUtil_wooden.getMobileDbm(context)) //
                put("phoneNumber", "")
            }
            Gson().toJson(data).trim().gzipString()

        } catch (e: java.lang.Exception) {
            null
        }
    }
}